package com.kedi.usercenter.read.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.kedi.usercenter.pcauthority.entity.*;

@Mapper
public interface PcAuthority {
	
	@Select("SELECT t.`administrator_role_id` AS administratorRoleId ,t.`is_super` AS isSuper,t.`rolename` FROM `administrator_role` t")
    List<AdministratorRole> selectAdministratorRole();
	
	@Select("SELECT administrator_authority_id AS administratorAuthorityId ,authority_name AS authorityName FROM  `administrator_authority` a WHERE EXISTS (SELECT * FROM `role_auth` t WHERE t.`administrator_role_id`=#{administrator_role_id} AND t.`administrator_authority_id`=a.administrator_authority_id)")
    List<AdministratorAuthority> selectAdministratorAuthority(@Param("administrator_role_id")int administrator_role_id);
	
	@Select("SELECT auth_source_id AS authSourceId,id,lable,url,html,bottum,parent_id AS parentId,TYPE FROM `auth_source` a WHERE EXISTS (SELECT * FROM `role_source` t WHERE t.`administrator_authority_id`=#{administrator_authority_id} AND a.`auth_source_id`=t.`auth_source_id`)")
	List<AuthLableSource> selectAuthLableSource(@Param("administrator_authority_id")int administrator_authority_id);

}
